package com.qf.market.service;

import com.github.pagehelper.PageInfo;
import com.qf.market.dao.OrderDao;
import com.qf.market.po.Order;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class OrderServiceImpl implements OrderService{
    @Resource
    OrderDao orderDao;

    @Override
    public PageInfo<Order> getAllOrderByPage(Map params) {
        List<Order> orderList=orderDao.getAllOrderByPage(params);
        PageInfo<Order> pageInfo = new PageInfo<Order>(orderList);
        return pageInfo;
    }

    @Override
    public boolean addOrder(Order order) {
        boolean f=orderDao.addOrder(order) > 0?true:false;
        return f;
    }

    @Override
    public boolean delOrder(String orderNum) {
        boolean f=orderDao.delOrder(orderNum) > 0?true:false;
        return f;
    }

    @Override
    public boolean updateStatus(Order order) {
        boolean f=orderDao.updateStatus(order) > 0?true:false;
        return f;
    }

    @Override
    public boolean updateOrderTotalAmount(Order order) {
        boolean f=orderDao.updateOrderTotalAmount(order) > 0?true:false;
        return f;
    }

}
